is not a
Type
operator
Summary
Evaluates to true if a value is not of the specified type, false otherwise.
Syntax
<value> is not a[n] {array | [numeric] sequence | | boolean | integer | number | point | rect| date | color | ASCII string}
Description
Use the is not a operator to validate data to make sure it's not the wrong type.
This operator is useful for checking whether the user has entered data correctly, and for checking parameters before sending them to a handler to avoid a script error caused by feeding data of one type to an operator or function that requires a different type.
A value is a(n):
- array if its keys function is not empty.
- sequence if its keys function is not empty and has N integer keys spanning 1 to N.
- numeric sequence if its keys function is not empty and has N integer keys spanning X to Y
- boolean or logical if it is one of the two constants true or false
- integer if it consists of digits (with an optional minus sign)
- number if it consists of digits, optional leading minus sign, optional decimal point, and optional "E" or "e" (scientific notation)
- point if it consists of two numbers separated by a comma
- rect if it consists of four numbers separated by commas
- date if it is in one of the formats produced by the date or time functions
- color if it is a valid color reference
- ASCII string if it does not contain any characters greater than charToNum(127)
All the types other than boolean can also include leading or trailing white space characters.
The is not a operator is the logical inverse of the is a operator. When one is true, the other is false.
Parameters
Name | Type | Description |
---|---|---|
value | Any source of value. |
Examples
22 is not a number
CJ22 is not a number
numToChar(128) is not an ASCII string -- evaluates to true
Related
glossary: evaluate, operator, validate
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile